package com.johndriver.selenium.driver;

import com.johndriver.selenium.utils.DriverUtil;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.net.MalformedURLException;

/**
 * 创建简单Driver
 * 日期 2021/5/22 16:12
 * 创建者：john driver
 */
public class DriverDemo {
    public static void main(String[] args) {
        chrome();
        firefox();
    }
    public static WebDriver driver(){
        System.setProperty("webdriver.chrome.driver", "src\\main\\resources\\static\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        return driver;
    }

    private static void firefox() {
        System.setProperty("webdriver.gecko.driver", "src\\main\\resources\\static\\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.hao123.com/?tn=96338394_hao_pg");
        driver.quit();
    }

    private static void chrome() {
        System.setProperty("webdriver.chrome.driver", "src\\main\\resources\\static\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.hao123.com/?tn=96338394_hao_pg");
        driver.quit();
    }
}
